package com.wjb.service.impl;


import com.wjb.mapper.UserMapper;
import com.wjb.model.EbUser;
import com.wjb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public List<EbUser> listByPage(int page, int pageSize) {
        int from = (page-1)*pageSize;
        return userMapper.findByPage(from,pageSize);
    }

    @Override
    public Integer getMaxPage(Integer pageSize) {
        return userMapper.getMaxPage(pageSize);
    }

    @Override
    public Integer save(EbUser ebUser) {
        return userMapper.save(ebUser);
    }

    @Override
    public EbUser selectOne(String euUserId) {
        return userMapper.selectOne(euUserId);
    }

    @Override
    public EbUser selectByCondition(String euUserId) {
        return userMapper.selectById(euUserId);
    }

    @Override
    public Integer updateUser(EbUser ebUser) {
        return userMapper.updateByPrimaryKey(ebUser);
    }

    @Override
    public int delete(String euUserId) {
        return userMapper.remove(euUserId);
    }

    @Override
    public EbUser login(String userName, String passWord){
        return  userMapper.findUserByUserNameAndPassword(userName,passWord);
    }
}

